package com.hdjk.view.entity;

import com.lst.projectlib.entity.BaseEntity;

import java.util.List;

/**
 * Created by sxy on 2017/11/10.
 */

public class BuyPlanEntity extends BaseEntity {

    private String accountNumber;
    private int rspId;
    private String portfolioName;
    private String portfolioCode;
    private int investorPayId;
    private String investorPayBankAccountNumber;
    private String investorPayBankName;
    private String investorPayBankCode;
    private String rspStatus;
    private List<Products> products;
    private String cycle;
    private int cycleDay;
    private String postponeDeduction;
    private long createdDate;
    private long updatedDate;
    private long nextRunDate;
    private String name;
    private String targetAmount;
    private String type;
    private String standingInstructionNum;
    public String getSum(){
        double sum=0;
        if (products!=null){
            for (int i=0;i<products.size();i++){
                sum=sum+Double.parseDouble(products.get(i).getRspAmount());
            }
        }
        return sum+"";
    }
    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }

    public String getAccountNumber() {
        return accountNumber;
    }

    public void setRspId(int rspId) {
        this.rspId = rspId;
    }

    public int getRspId() {
        return rspId;
    }

    public void setPortfolioName(String portfolioName) {
        this.portfolioName = portfolioName;
    }

    public String getPortfolioName() {
        return portfolioName;
    }

    public void setPortfolioCode(String portfolioCode) {
        this.portfolioCode = portfolioCode;
    }

    public String getPortfolioCode() {
        return portfolioCode;
    }

    public void setInvestorPayId(int investorPayId) {
        this.investorPayId = investorPayId;
    }

    public int getInvestorPayId() {
        return investorPayId;
    }

    public void setInvestorPayBankAccountNumber(String investorPayBankAccountNumber) {
        this.investorPayBankAccountNumber = investorPayBankAccountNumber;
    }

    public String getInvestorPayBankAccountNumber() {
        return investorPayBankAccountNumber;
    }

    public void setInvestorPayBankName(String investorPayBankName) {
        this.investorPayBankName = investorPayBankName;
    }

    public String getInvestorPayBankName() {
        return investorPayBankName;
    }

    public void setInvestorPayBankCode(String investorPayBankCode) {
        this.investorPayBankCode = investorPayBankCode;
    }

    public String getInvestorPayBankCode() {
        return investorPayBankCode;
    }

    public void setRspStatus(String rspStatus) {
        this.rspStatus = rspStatus;
    }

    public String getRspStatus() {
        return rspStatus;
    }
    public String getRspStatusName() {
        String status="";
        switch (rspStatus){
            case "active":
                status="执行中";
                break;
            case "suspend":
                status="已暂停";
                break;
            case "terminated":
                status="已终止";
                break;
        }
        return status;
    }
    public void setProducts(List<Products> products) {
        this.products = products;
    }

    public List<Products> getProducts() {
        return products;
    }

    public void setCycle(String cycle) {
        this.cycle = cycle;
    }

    public String getCycle() {
        return cycle;
    }
    public String getCycleName() {
        String status="";
        switch (cycle){
            case "weekly":
                status="每周";
                break;
            case "biweekly":
                status="每两周";
                break;
            case "monthly":
                status="每月";
                break;
            case "quarterly":
                status="每季";
                break;
        }
        return status;
    }
    public void setCycleDay(int cycleDay) {
        this.cycleDay = cycleDay;
    }

    public int getCycleDay() {
        return cycleDay;
    }
    public String getCycleDayName() {
        String status="";
        switch (cycle){
            case "weekly":
            case "biweekly":
                switch (cycleDay){
                    case 1:
                        status="星期一";
                        break;
                    case 2:
                        status="星期二";
                        break;
                    case 3:
                        status="星期三";
                        break;
                    case 4:
                        status="星期四";
                        break;
                    case 5:
                        status="星期五";
                        break;
                }
                break;
            case "monthly":
            case "quarterly":
                status=cycleDay+"日";
                break;
        }
        return status;
    }
    public void setPostponeDeduction(String postponeDeduction) {
        this.postponeDeduction = postponeDeduction;
    }

    public String getPostponeDeduction() {
        return postponeDeduction;
    }

    public void setCreatedDate(long createdDate) {
        this.createdDate = createdDate;
    }

    public long getCreatedDate() {
        return createdDate;
    }

    public void setUpdatedDate(long updatedDate) {
        this.updatedDate = updatedDate;
    }

    public long getUpdatedDate() {
        return updatedDate;
    }

    public void setNextRunDate(long nextRunDate) {
        this.nextRunDate = nextRunDate;
    }

    public long getNextRunDate() {
        return nextRunDate;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setTargetAmount(String targetAmount) {
        this.targetAmount = targetAmount;
    }

    public String getTargetAmount() {
        return targetAmount;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getType() {
        return type;
    }

    public void setStandingInstructionNum(String standingInstructionNum) {
        this.standingInstructionNum = standingInstructionNum;
    }

    public String getStandingInstructionNum() {
        return standingInstructionNum;
    }

    public class Products extends BaseEntity{

        private String fundCode;
        private String fundName;
        private String rspAmount;
        private String currency;

        public void setFundCode(String fundCode) {
            this.fundCode = fundCode;
        }

        public String getFundCode() {
            return fundCode;
        }

        public void setFundName(String fundName) {
            this.fundName = fundName;
        }

        public String getFundName() {
            return fundName;
        }

        public void setRspAmount(String rspAmount) {
            this.rspAmount = rspAmount;
        }

        public String getRspAmount() {
            return rspAmount;
        }

        public void setCurrency(String currency) {
            this.currency = currency;
        }

        public String getCurrency() {
            return currency;
        }

    }
}
